/*
 * @Author: your name
 * @Date: 2021-05-03 10:44:49
 * @LastEditTime: 2021-05-13 09:45:06
 * @LastEditors: Please set LastEditors
 * @Description: In User Settings Edit
 * @FilePath: \vue01d:\HTML001\布局小技巧\鼠标滑动拖尾\鼠标滑动拖尾.js
 */

const body = document.querySelector("body");
const num = Math.random() * 50;

body.addEventListener("mousemove", fun);

var old = 0
function fun(e) {
    let now = +new Date()
    if(now-old>30){
      const a = document.createElement("div");
      a.className = "one";
      a.style.top = e.clientY + "px";
      a.style.left = e.clientX + "px";
      body.appendChild(a);
      setTimeout(function () {
        body.removeChild(a);
      }, 1000);
      old = now
    }

    // console.log(old)
}
